<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/*Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});*/

Route::group(['namespace'=>'Api'],function ($route){
    //文件上传接口
    $route->post('upload', 'ApiController@upload')->name('api.upload');
    $route->post('uploadMedia', 'ApiController@uploadMedia');
    $route->post('uploadMedia2', 'ApiController@uploadMedia2');
    $route->post('uEditorUpload', 'ApiController@uEditorUpload');

    Route::get('test/demo', 'TestController@demo');//测试演示功能

});

//小雨手动洗车机的业务路由
Route::group(['namespace'=>'Api'],function (){
    
    Route::get('device/onlinedevice', 'DeviceController@onlinedevice');//查询所有在线设备状态
    Route::get('device/single_start_callback', 'DeviceController@start_callback');//启动后回调
    Route::get('device/single_end_callback', 'DeviceController@end_callback');//消费后回调
    
    //设备相关
    Route::group(['prefix'=>'device', 'middleware' => ['auth.api']], function () {
        Route::get('status', 'DeviceController@status');//查询传递过来设备的状态
        Route::get('detail', 'DeviceController@detail');//扫码后的设备详情页数据
        Route::post('saveorder', 'DeviceController@saveorder');//选择洗车模式后，提前生成订单
        Route::get('start', 'DeviceController@start');//启动机器

    });
    
    //站点路由
    Route::group(['prefix'=>'site', 'middleware' => ['auth.api']], function () {
        Route::get('list', 'SiteController@list');// 站点列表数据
        Route::get('detail', 'SiteController@detail');// 指定站点详情
        Route::get('recommend', 'SiteController@recommend');// 推荐最近一个站点数据        
    });

    //用户
    Route::group(['prefix'=>'xcuser'], function () {
        Route::get('getinfo', 'WechatController@getUserInfo');//获得当前客户的信息
        Route::get('xcxqrcode', 'WechatController@xcxqrcode');//生成小程序码
        Route::get('getwxmobile', 'WechatController@getwxmobile');//获得当前用户手机号码
        Route::get('updatemobile', 'XuserController@updatemobile');//更新用户信息
        Route::get('usercard', 'XuserController@usercard');//获得用户的会员卡列表
        Route::get('getorder', 'XuserController@getorder');//小程序端获得未支付的订单信息
        Route::get('getuserrole', 'XuserController@getuserrole');//小程序端获得用户权限
        Route::post('updateInfo', 'XuserController@updateInfo');//更新用户信息头像
        Route::get('mysiteorder', 'XcUserManagementController@mysiteorder');//我的>我的订单>消费订单
    });

    //客户管理
    Route::group(['prefix'=>'usermanagement', 'middleware' => ['auth.api']], function () {
        Route::get('rechargelist', 'XcUserManagementController@rechargelist');// 充值订单列表
        Route::get('siteorderlist', 'XcUserManagementController@siteorderlist');// 支付订单列表
        Route::get('orderlistall', 'XcUserManagementController@orderlistall');// 我的 > 管理员 > 全部订单列表

    });

    //充值
    Route::group(['prefix'=>'recharge', 'middleware' => ['auth.api']], function () {
        Route::get('settingAllList', 'RechargeController@settingAllList');//充值卡全部数据列表
        Route::get('settingList', 'RechargeController@settingList');//充值卡列表单类型
        Route::get('detail', 'RechargeController@detail');//充值卡详情
        Route::get('createOrder', 'RechargeController@createOrder');//创建充值卡订单
        Route::get('orderList', 'RechargeController@orderList');//订单列表
        Route::get('consumerDetail', 'RechargeController@consumerDetail');//消费明细
        Route::get('orderdetail', 'RechargeController@orderDetail');//订单详情
        Route::get('timesCardInfo', 'RechargeController@timesCardInfo');//次卡信息
    });




    
});
